<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
 <%@include file="/WEB-INF/jsp/common/common.jsp" %>   
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
		
</head>
<body>
	<!-- <table class="layui-table" id="demo" lay-filter="demo" lay-skin="row"> -->
	<table class="layui-table" id="demo" lay-filter="demo" >
		  <thead>
		    <tr>
		      <th>账号</th>
		      <th>名称</th> 
		      <th>头像</th>
		      <th>qq</th> 
		      <th>email</th>
		      <th>tel</th>
		      <th>sex</th>
		      <th>部门</th>
		      <th colspan="2">操作</th>
		    </tr> 
		  </thead>
		<tbody>
			<c:forEach items="${lists }" var="item">
				<tr>
			      <td>${item.username }</td>
			      <td>${item.name }</td>
			      <td><img src="${item.img }"/></td>
			      <td>${item.qq }</td>
			      <td>${item.email }</td>
			      <td>${item.tel }</td>
			      <td>
				      <c:if test="${item.sex==0 }">
				      	男
				      </c:if>
				       <c:if test="${item.sex==1 }">
				      	女
				      </c:if>
			      </td>
			       <td>${item.deptid }</td>
			      <td >
				     <button  class="layui-btn " onclick="update('${item.id}')"><i class="layui-icon"></i></button>
			      </td>
			      <td >
				     <button  class="layui-btn layui-btn-danger" onclick="del('${item.id}')"><i class="layui-icon"></i></button>
			      </td>  
			    </tr>
			</c:forEach>
		 </tbody>
	</table>

<script >
	
	function update(id){
		
		layui.use('layer', function() {
			
			 layer.open({
			      type: 2,
			      title: '很多时候，我们想最大化看，比如像这个页面。',
			      shadeClose: true,
			      //shade: false,
			      maxmin: true, //开启最大化最小化按钮
			      area: ['700px', '600px'],
			      content: '${ctx}/employee/toUpdate/'+id
			    });
			
			 /* layer.open({
				  type: 2,
				  title: false,
				  closeBtn: 0, //不显示关闭按钮
				  shade: [0],
				  area: ['340px', '215px'],
				  offset: 'rb', //右下角弹出
				  time: 2000, //2秒后自动关闭
				  anim: 2,
				  content: ['', 'no'], //iframe的url，no代表不显示滚动条
				  end: function(){ //此处用于演示
				    layer.open({
				      type: 2,
				      title: '很多时候，我们想最大化看，比如像这个页面。',
				      shadeClose: true,
				      shade: false,
				      maxmin: true, //开启最大化最小化按钮
				      area: ['893px', '600px'],
				      content: '${ctx}/employee/update/'+id
				    });
				  }
				}); */
			
		});
		
	}
	


	function del(id){
		layui.use('layer', function() {
			var layer =layui.layer;	
			
			layer.confirm('真的删除行么'+id, function(index) {
				//obj.del();
				//console.log(data);
				var url ="${ctx}/employee/delete/"+data.id;
				alert(url);
				$.post(url,function(data){
					alert(data);
					obj.del();
				},"text");
				layer.close(index);
			});
		});
		
	}
	

</script>



</body>
</html>
